@extends('admin.layouts')
@section('css')
    <link href="{{asset('assets/css/bootstrap.min.css')}}" rel="stylesheet" />
    <link rel="stylesheet" href="{{asset('assets/css/font-awesome.min.css')}}" />
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />

    <link rel="stylesheet" href="{{asset('assets/css/ace.min.css')}}" />
    <link rel="stylesheet" href="{{asset('assets/css/ace-rtl.min.css')}}" />
    <link rel="stylesheet" href="{{asset('assets/css/ace-skins.min.css')}}" />
    <script src="{{asset('assets/js/ace-extra.min.js')}}"></script>
    <link rel="stylesheet" type="text/css" href="{{asset('assets/uploadifive/uploadifive.css')}}">
    <style>
        .uploadifive-button{border:none; border-radius:1px; height: 28px;background:#3bb4f2;color:#fff;}
        #uploadifive-file_upload{margin:auto}
        .uploadifive{display:inline-block;}
        /*.uploadifive-button{border:none; border-radius:1px; height: 28px;}*/
    </style>
@endsection
@section('content')


    <div class="main-content">
        <div class="breadcrumbs" id="breadcrumbs">
            <script type="text/javascript">
                try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
            </script>

            <ul class="breadcrumb">
                <li>
                    <i class="icon-home home-icon"></i>
                    <a href="#">首页</a>
                </li>
                <li class="active">作者详情</li>
            </ul><!-- .breadcrumb -->

            <div class="nav-search" id="nav-search">
                <form class="form-search">
								<span class="input-icon">
									<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
									<i class="icon-search nav-search-icon"></i>
								</span>
                </form>
            </div><!-- #nav-search -->
        </div>

        <div class="page-content">
            <div class="page-header">
                <h1>
                    作者详情
                </h1>
            </div><!-- /.page-header -->

            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->

                    <div>
                        <div id="user-profile-2" class="user-profile">
                            <div class="tabbable">
                                <ul class="nav nav-tabs padding-18">
                                    <li class="active">
                                        <a data-toggle="tab" href="#home">
                                            <i class="green icon-user bigger-120"></i>
                                            个人资料
                                        </a>
                                    </li>

                                    <li>
                                        <a data-toggle="tab" href="#feed">
                                            <i class="orange icon-rss bigger-120"></i>
                                            我的活动记录
                                        </a>
                                    </li>

                                    <li>
                                        <a data-toggle="tab" href="#friends">
                                            <i class="blue icon-group bigger-120"></i>
                                            关注我的人
                                        </a>
                                    </li>
                                </ul>

                                <div class="tab-content no-border padding-24">
                                    <div id="home" class="tab-pane in active">
                                        <div class="row">
                                            <div class="col-xs-12 col-sm-3 center">
                                                <span class="profile-picture">
                                                    <img id="shoAvatar" class="editable img-responsive" style="width: 180px;height: 200px" alt="Alex's Avatar"
                                                         @if(!empty($userinfo[0]->avatar))
                                                         src="{{$userinfo[0]->avatar}}"
                                                         @else
                                                         src="{{asset('assets/avatars/profile-pic.jpg')}}"
                                                            @endif
                                                    />
                                                </span>

                                                <div class="space space-4"></div>
                                                <div id="tip-queue" class="col-xs-4" style="display: none"></div>
                                                <input id="file_upload" type="file" name="avatar" />
                                            </div><!-- /span -->

                                            <div class="col-xs-12 col-sm-9">
                                                <h4 class="blue">
                                                    <span class="middle">{{\Illuminate\Support\Facades\Session::get('admin')['username']}}</span>

																<span class="label label-purple arrowed-in-right">
																	<i class="icon-circle smaller-80 align-middle"></i>
																	online
																</span>
                                                </h4>

                                                <div class="profile-user-info">
                                                    <div class="profile-info-row">
                                                        <div class="profile-info-name"> 用户名 </div>

                                                        <div class="profile-info-value">
                                                            <span>{{\Illuminate\Support\Facades\Session::get('admin')['username']}}</span>
                                                        </div>
                                                    </div>

                                                    <div class="profile-info-row">
                                                        <div class="profile-info-name"> 地址 </div>

                                                        <div class="profile-info-value">
                                                            <i class="icon-map-marker light-orange bigger-110"></i>
                                                            {{$userinfo[0]->address}}
                                                        </div>
                                                    </div>

                                                    <div class="profile-info-row">
                                                        <div class="profile-info-name"> 年龄 </div>

                                                        <div class="profile-info-value">
                                                            <span>{{$userinfo[0]->age}}</span>
                                                        </div>
                                                    </div>

                                                    <div class="profile-info-row">
                                                        <div class="profile-info-name"> 学历 </div>

                                                        <div class="profile-info-value">
                                                            <span>{{$userinfo[0]->education}}</span>
                                                        </div>
                                                    </div>

                                                    <div class="profile-info-row">
                                                        <div class="profile-info-name"> 加入时间 </div>

                                                        <div class="profile-info-value">
                                                            <span>{{$userinfo[0]->created_at}}</span>
                                                        </div>
                                                    </div>

                                                    <div class="profile-info-row">
                                                        <div class="profile-info-name"> 性别 </div>

                                                        <div class="profile-info-value">
                                                            <span>
                                                                {{$userinfo[0]->sex}}
                                                            </span>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="hr hr-8 dotted"></div>

                                                <div class="profile-user-info">
                                                    <div class="profile-info-row">
                                                        <div class="profile-info-name"> 身份 </div>

                                                        <div class="profile-info-value">
                                                            <a href="javascript:;" target="_blank">{{$userinfo[0]->role}}</a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div><!-- /span -->
                                        </div><!-- /row-fluid -->

                                        <div class="space-20"></div>

                                       <div class="row">
                                            <div class="col-xs-12 col-sm-6">
                                                <div class="widget-box transparent">
                                                    <div class="widget-header widget-header-small">
                                                        <h4 class="smaller">
                                                            <i class="icon-check bigger-110"></i>
                                                           介绍/简介
                                                        </h4>
                                                    </div>

                                                    <div class="widget-body">
                                                        <div class="widget-main">
                                                            <p>
                                                                {{$userinfo[0]->describe}}
                                                            </p>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="col-xs-12 col-sm-6">
                                                <div class="widget-box transparent">
                                                    <div class="widget-header widget-header-small header-color-blue2">
                                                        <h4 class="smaller">
                                                            <i class="icon-lightbulb bigger-120"></i>我的发布
                                                        </h4>
                                                    </div>

                                                    <div class="widget-body">
                                                        <div class="widget-main padding-16">
                                                            <div class="clearfix">
                                                                @if(Session::get('admin')['role']==2 || Session::get('admin')['role']==5)
                                                                <div class="grid3 center">
                                                                    <div class="easy-pie-chart percentage" data-percent="45" data-color="#CA5952">
                                                                        <span class="percent">{{$num['a']}}</span>篇
                                                                    </div>

                                                                    <div class="space-2"></div>
                                                                    文章
                                                                </div>
                                                                @endif
                                                                @if(Session::get('admin')['role']==3 || Session::get('admin')['role']==5)
                                                                <div class="grid3 center">
                                                                    <div class="center easy-pie-chart percentage" data-percent="90" data-color="#59A84B">
                                                                        <span class="percent">{{$num['i']}}</span>篇
                                                                    </div>

                                                                    <div class="space-2"></div>
                                                                    图集
                                                                </div>
                                                                            @endif
                                                            </div>

                                                            <div class="hr hr-16"></div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div><!-- #home -->

                                    <div id="feed" class="tab-pane">
                                        {{--<div class="profile-feed row-fluid">--}}
                                            <div id="profile-feed-1" class="profile-feed">
                                                @foreach($logs as $log)
                                                    <div class="profile-activity clearfix">
                                                        <div>
                                                            <img class="pull-left" alt="Susan Smith's avatar" src="{{asset('assets/avatars/avatar2.png')}}" />
                                                            <a class="user" href="#"> {{$log['username']}} </a>
                                                            {{$log['event']}}
                                                            <div class="time">
                                                                <i class="icon-time bigger-110"></i>
                                                                {{date('Y-m-d H:i:s',$log['created_at'])}}
                                                            </div>
                                                        </div>
                                                    </div>
                                                @endforeach
                                            </div>
                                        {{--</div><!-- /row -->--}}

                                    </div><!-- /#feed -->

                                    <div id="friends" class="tab-pane">
                                        <div class="profile-users clearfix">
                                            @foreach($starP as $p)
                                            <div class="itemdiv memberdiv">
                                                <div class="inline position-relative">
                                                    <div class="user">
                                                        <a href="#">
                                                            <img src="{{$p['avatar']}}" alt="{{$p['username']}}" />
                                                        </a>
                                                    </div>

                                                    <div class="body">
                                                        <div class="name">
                                                            <a href="#">
                                                                <span class="user-status status-online"></span>
                                                                {{$p['username']}}
                                                            </a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            @endforeach
                                        </div>

                                        <div class="hr hr10 hr-double"></div>
                                    </div><!-- /#friends -->
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div><!-- /.main-content -->


@endsection

@section('javascript')
    <script src='{{asset('assets/js/jquery-2.0.3.min.js')}}'></script>
    <script src="{{asset('assets/js/bootstrap.min.js')}}"></script>
    <script src="{{asset('assets/js/typeahead-bs2.min.js')}}"></script>

    <!-- ace scripts -->
    <script type="text/javascript" src="{{asset('assets/layer/layer.js')}}"></script>
    <script src="{{asset('assets/js/ace-elements.min.js')}}"></script>
    <script src="{{asset('assets/js/ace.min.js')}}"></script>

    <script type="text/javascript" src="{{asset('assets/uploadifive/jquery.uploadifive.js')}}"></script>
    <script src="{{asset('assets/js/jquery.slimscroll.min.js')}}"></script>

    <script type="text/javascript">


        $('#file_upload').uploadifive({
            'formData'     : {
                '_token'     : "{{csrf_token()}}"
            },
            'uploadScript' : "{{asset('admin/uploadimg')}}",
            'multi':false,
            'buttonText'   : '更换头像',   //按钮显示文字
            'queueID'      : 'tip-queue', //提示信息放置目标
            'fileType'     : 'image/*',   //允许上传文件类型
            'onSelect': function (file) {
                layer.load(1);
            },
            'onUploadComplete': function(file,data,response){
                layer.closeAll('loading');
                data= $.parseJSON(data);
                if(!data.status){
                    alert(data.msg);
                }else{
                    layer.msg('图片上传完毕');
                    $("#shoAvatar").attr('src',data.msg+'-185X141');
                    $.post('{{url('admin/authorinfo')}}',{"_token":'{{csrf_token()}}','avatar':data.msg}, function (res) {
                        layer.msg(res.msg);
                    });
                }

            }
        });
        jQuery(function($) {
            //////////////////////////////
            $('#profile-feed-1').slimScroll({
                height: '300px',
                alwaysVisible : false
            });

        });
    </script>
@endsection